package com.aaa.ss;

import com.aaa.ss.config.MyRule;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.context.annotation.Bean;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.client.RestTemplate;

/**
 * @fileName:SalesApp
 * @description:
 * @author:忆尘
 * @createTime:2020/11/5 14:57
 * @version:1.0.0
 */

@SpringBootApplication
@MapperScan("com.aaa.ss.dao")
@EnableTransactionManagement
@EnableDiscoveryClient
@RibbonClient(name = "salesClient",configuration = MyRule.class)
@EnableCircuitBreaker
public class SalesApp {
    public static void main(String[] args) {
        SpringApplication.run(SalesApp.class,args);
    }


    /**
     * 初始化RestTemplate
     * @return
     */
    @Bean
    @LoadBalanced
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }
}
